<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - PairField Usage</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset/reset-min.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/fonts/fonts-min.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">

 </head>

 <body>

<p class='demoTitle'>inputEx - PairField Usage</p>

<p>The PairField is now deprecated. It has been replaced by the <a href='combine_field.html'>CombineField</a>, which is much more powerful.</p>

<!-- Example 1 -->
<div class='exampleDiv'>

	<p class="title">Basic PairField creation</p>
	
	<p>Use the following code to create a basic inputEx PairField.</p>

	<div class='demoContainer' id='container1'></div>

	<div class='codeContainer'>
		<form>
		<textarea name="code" class="JScript">
			new inputEx.PairField({parentEl: 'container1', showMsg: true});
		</textarea>
		</form>
	</div>

</div>



<!-- Example 2 -->
<div class='exampleDiv'>

	<p class="title">PairField composition</p>
	
	<p>Composition</p>

	<div class='demoContainer' id='container2'></div>

	<div class='codeContainer'>
		<form>
		<textarea name="code" class="JScript">
			var field = new YAHOO.inputEx.PairField({
				label: 'Your favorite color',
				parentEl: 'container2',
				showMsg: true,
				leftFieldOptions: {type: 'string', inputParams: { description: 'Favorite color', value: 'blue'} },
		    rightFieldOptions: { type: 'text', inputParams: { description: 'Why is it your favorite color ?', value: 'looks like the sky' } }
			});
			var button = YAHOO.inputEx.cn('button', null, null, "getValue");
			YAHOO.util.Event.addListener(button, 'click', function() {
				alert( YAHOO.lang.JSON.stringify(field.getValue()) );
			});
			YAHOO.util.Dom.get('container2').appendChild(button);
		</textarea>
		</form>
	</div>

</div>


<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/yahoo/yahoo-min.js"></script> 
<script type="text/javascript" src="../lib/yui/dom/dom-min.js"></script> 
<script type="text/javascript" src="../lib/yui/event/event-min.js"></script>
<script type="text/javascript" src="../lib/yui/container/container-min.js"></script>
<script type="text/javascript" src="../lib/yui/json/json-min.js"></script>

<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/fields/StringField.js"  type='text/javascript'></script>
<script src="../js/fields/Textarea.js"  type='text/javascript'></script>

<script src="../js/fields/CombineField.js"  type='text/javascript'></script>
<script src="../js/fields/PairField.js"  type='text/javascript'></script>

<script>

YAHOO.util.Event.addListener(window, 'load', function() {

	// Example 1
	new YAHOO.inputEx.PairField({parentEl: 'container1', showMsg: true});

	// Example 2
	var field = new YAHOO.inputEx.PairField({
		label: 'Your favorite color',
		parentEl: 'container2',
		showMsg: true,
		leftFieldOptions: {type: 'string', inputParams: { description: 'Favorite color', value: 'blue'} },
    rightFieldOptions: { type: 'text', inputParams: { description: 'Why is it your favorite color ?', value: 'looks like the sky' } }
	});
	var button = YAHOO.inputEx.cn('button', null, null, "getValue");
	YAHOO.util.Event.addListener(button, 'click', function() {
		alert( YAHOO.lang.JSON.stringify(field.getValue()) );
	});
	YAHOO.util.Dom.get('container2').appendChild(button);
});

</script>

<script src="js/dpSyntaxHighlighter.js"></script>
<script language="javascript"> 
dp.SyntaxHighlighter.HighlightAll('code');
</script>

 </body>
</html>